#ifndef __COMPONENT_WALK_AROUND_BEHAVIOR_H__
#define __COMPONENT_WALK_AROUND_BEHAVIOR_H__

#include "ComponentBehavior.hpp"
#include "Engine/MathUtils.hpp"
#include "EasyMachine.hpp"

using namespace PocketSurvival::Engine;

namespace PocketSurvival
{

    struct ComponentWalkAroundBehavior;
    struct ComponentCreature;
    struct ComponentPathfinding;

    struct ComponentWalkAroundBehavior : public ComponentBehavior
    {
    protected:
        enum class MachineState
        {
            Inactive,
            Walk
        };

        class StateMachine : public EasyMachine<MachineState>
        {
        protected:
            ComponentWalkAroundBehavior * m_walkAround;
        public:
            StateMachine(ComponentWalkAroundBehavior *walkAround);

            virtual void enter() override;
            virtual void update(float dt) override;
            virtual void leave() override;
        };

    protected:
        float m_importanceLevel;
        StateMachine *m_stateMachine;

    public:
        ComponentCreature *componentCreature;
        ComponentPathfinding *componentPathfinding;

        ComponentWalkAroundBehavior() = default;
        ~ComponentWalkAroundBehavior();

        virtual float getImportanceLevel() override;
        Vector3 findDestination();
        float scoreDestination(const Vector3 &destination);


        virtual void update(float dt) override;
        virtual void load(const nlohmann::json &jsonData) override;
        virtual const std::string &getName() const override;
        static const std::string &GetName();

    };
}

#endif
